/* 
 * Copyright (C), 2016-2020, 厦门盈欣宝金融信息服务有限公司
 * Project Name :cloud-parent
 * File Name: org.easytouseit.eurekaclient.controller
 * Encoding UTF-8 
 * Version: 1.0 
 * Date: 2018-09-28 14:20
 * History:  
 * 1. Date: 2018-09-28
 *    Author: guojm 
 *    Modification: 新建
 * 2. ...
 */
package org.easytouseit.eurekaclient.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @author guojm
 * @version V1.0
 * @date 2018-09-28 下午 14:20
 */
@RestController
public class ClientController {
    @RequestMapping("/hello")
    public String index(@RequestParam String name) {
        System.out.println("ga1");
        sleep("hello");
        return "hello "+name+"，this is first messge";
    }

    private void sleep(String methodName) {
        //int sleepMinTime = new Random().nextInt(6000);
        int sleepMinTime=3000;
        System.out.println("helloService1 "+methodName+" sleepMinTime: "+sleepMinTime);
        try {
            Thread.sleep(sleepMinTime);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }


}
